package com.margo.rabbit.springboot.producer;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/message")
public class MargoProducerController {
	
	@Autowired
	private RabbitTemplate rabbitTemplate;
	
	@ResponseBody
	@RequestMapping("/send")
	public String sendMsg() {
		rabbitTemplate.convertAndSend("", "margo-direct","margo");
		return "ok";
	}
}
